﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DispatchAssist.BusinessLogical.Model
{
    public class CacheACARDevice
    {
        private List<ACARSDevice> _list;

        public List<ACARSDevice> AcarsDeviceList
        {
            get
            {
                return _list;
            }
        }

        public CacheACARDevice(List<ACARSDevice> list)
        {
            _list = list;
        }

        public ACARSDevice GetACARSDeviceByPara(string TailNo)
        {
            return _list.Where(f => f.TailNo == TailNo).ToList()[0];
        }

        public string GetACARSDeviceTypeByPara(string TailNo)
        {
            try
            {
                ACARSDevice model = GetACARSDeviceByPara(TailNo);
                return model.ACARSType;
            }
            catch
            {
                return null;
            }
           
        }

        public List<ACARSDevice> GetTailsByPlaneType(int typeID)
        {
            try
            {
                return _list.Where(f => f.PlaneTypeID == typeID).ToList();
            }
            catch
            {
                return null;
            }

        } 
    }
}
